<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>对象语法示例</title>
  <style>
    .active {
      color: green;
      font-weight: bold;
    }
  </style>
</head>
<body>
  <div id="app">
    <!-- 使用对象语法绑定 class -->
    <p v-bind:class="{ active: isActive }">这是一段文本</p>
    <button @click="toggleActive">切换高亮</button>
  </div>

  <script src="../../../js/vue.js"></script>
  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        isActive: false  // 初始状态不高亮
      },
      methods: {
        toggleActive: function() {
          // 切换 isActive 状态，高亮效果随之改变
          this.isActive = !this.isActive;
        }
      }
    });
  </script>
</body>
</html>